package com.zdtech.action;

import javax.annotation.Resource;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import com.zdtech.service.BaseSerive;
import com.zdtech.util.StringUtil;

public class LoginAction extends ActionSupport{
	
	private String username;
	private String pwd;
	@Resource
	private BaseSerive baseSerive;
	
	public String execute() throws Exception {
		if(StringUtil.isEmpty(username)){
			if(StringUtil.isEmpty(pwd)){
				Boolean flag = baseSerive.checkUser(username, pwd);
				if(flag) return Action.SUCCESS;
				else System.out.println("password error");
			}else{
				System.out.println("password empty");
			}
		}else{
			System.out.println("username empty");
		}
		return Action.ERROR;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPwd() {
		return pwd;
	}
	public void setPwd(String pwd) {
		this.pwd = pwd;
	}
	
}
